From: Antoine Musso Date: Mon, 20 Sep 2004 16:23:10 +0000 (+0000) Subject: Fix http://bugzilla.wikipedia.org/show_bug.cgi?id=538 X-Git-Tag: 1.5.0alpha1~1932 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=56a9b26a39b311ccdba3aec7b7d8e19c7b805ef7;p=lhc%2Fweb%2Fwiklou.git Fix bugzilla.wikipedia.org/show_bug.cgi?id=538 Return an 'emptyfile' error page if filename is empty. --- diff --git a/includes/SpecialUpload.php b/includes/SpecialUpload.php index 737c619730..c165513851 100644 --- a/includes/SpecialUpload.php +++ b/includes/SpecialUpload.php @@ -112,6 +112,8 @@ class UploadForm { global $wgCheckFileExtensions, $wgStrictFileExtensions; global $wgFileExtensions, $wgFileBlacklist, $wgUploadSizeWarning; + /** When using detailed copyright, if user filled field, assume he + * confirmed the upload */ if ( $wgUseCopyrightUpload ) { $this->mUploadAffirm = 1; if ($wgCheckCopyrightUpload && @@ -120,12 +122,13 @@ class UploadForm { } } + /** User need to confirm his upload */ if ( $this->mUploadAffirm != 1) { $this->mainUploadForm( WfMsg( 'noaffirmation' ) ); return; } - if ( '' != $this->mOname ) { + if ( $this->mOname != '' ) { $basename = strrchr( $this->mOname, '/' ); if ( false === $basename ) { $basename = $this->mOname; } @@ -152,7 +155,6 @@ class UploadForm { $basename = $bn; } - $nt = Title::newFromText( $basename ); if( !$nt ) { return $this->uploadError( wfMsg( 'illegalfilename', htmlspecialchars( $basename ) ) ); @@ -196,6 +198,9 @@ class UploadForm { } if($warning != '') return $this->uploadWarning($warning); } + } else { + return $this->uploadError('
  • '.wfMsg( 'emptyfile' ).'
  • '); + } if ( !is_null( $this->mUploadOldVersion ) ) { $wgUploadOldVersion = $this->mUploadOldVersion;